import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/home.vue'
import Index from '../components/index/index.vue'
import Login from '../components/login.vue'
import Register from '../components/register.vue'
import Topic from '../components/topic/topic.vue'
import Issue from '../components/issue/issue.vue'
import UserInfo from '../components/user_info/user_info.vue'
import Search from '../components/search/search.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Home,
    children: [
      {
        path: '/',
        component: Index
      },
      {
        path: '/topic/:id',
        component: Topic
      },
      {
        path: '/issue',
        component: Issue
      },
      {
        path: '/user_info',
        component: UserInfo
      },
      {
        path: '/search',
        component: Search
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
